package com.common.exceptions;


import org.apache.commons.lang.StringUtils;

import com.common.base.util.ServiceHelper;

public class CoreRuntimeException extends RuntimeException {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String code;
	private String[] params;
	
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String[] getParams() {
		return params;
	}

	public void setParams(String[] params) {
		this.params = params;
	}

	public CoreRuntimeException(){	
	}
	
	public CoreRuntimeException(String msg){	
		super(msg);
	}
	
	public CoreRuntimeException(String msg,Throwable cause){	
		super(msg,cause);
	}
	
	
//	public String getMessage() {
//		if (code == null || code.length() == 0) {
//			return super.getMessage();
//		}
//		String i18n = ServiceHelper.getMessage(code, params, null);
//		if (StringUtils.isNotEmpty(i18n)) {
//			return i18n;
//		}
//		String paramsStr = "NA";
//		if (params != null) {
//			paramsStr = StringUtils.join(params, ",");
//		}
//		String codeMessage = "code:" + code + ";parameters:" + paramsStr;
//		return codeMessage;
//	}
	
	public static String errorContent(Exception e){
		String result = "";
		if(e instanceof DaoException){
			result = "www";
		}
		
		return result;
	}
}
